<?php


namespace app\admin\controller;


use app\admin\business\messageBus;
use think\facade\View;

class Message extends AdminBase
{
    public function index(){
        return View::fetch();
    }
    public function detail(){
        $id = $this->request->param('id');
        View::assign('id',$id);
        return View::fetch();
    }
    public function getListPage(){
        $paging = $this->request->param('paging');
        $messageBus = new messageBus();
        try {
            $res = $messageBus->getListPageBus($paging);
        }catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'获取成功',$res);
    }
    public function getDetailByWhere(){
        $id = $this->request->param('id');
        $where = [
            'id'=>$id
        ];
        $messageBus = new messageBus();
        try {
            $res = $messageBus->getDetailByWhereBus($where);
        }catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'获取成功',$res);
    }
    public function removeByWhere(){
        $id = $this->request->param('id');
        $where = [
            'id'=>$id
        ];
        $messageBus = new messageBus();
        try {
            $res = $messageBus->removeByWhereBus($where);
        }catch (\Exception $exception){
            return show(config('status.error'),$exception->getMessage());
        }
        return show(config('status.success'),'删除成功',$res);
    }
}